package com.jiuyin.dianjing.api.base;

import android.content.Context;

import com.google.gson.Gson;
import com.google.gson.JsonParser;
import com.jiuyin.dianjing.api.loader.ApiLoader;
import com.jiuyin.dianjing.util.LogUtil;

/**
 * Description:
 * File: BaseApiHelper.java
 * Create: 2019/04/08 14:32
 *
 * @Author: Administrator
 */
public abstract class BaseApiHelper {
    protected Context mContext;
    protected ApiLoader mApiLoader;
    private Gson gson = new Gson();
    private JsonParser jsonParser = new JsonParser();

    protected Context getContext() {
        return mContext;
    }

    protected void setContext(Context context) {
        if (context != null) {
            mContext = context;
        }
    }

    /**
     * 日志输出
     *
     * @param type    String 日志前缀
     * @param content String 内容
     */
    protected abstract void showLog(final String type, final String content);

    protected void showLog(final String content) {
        LogUtil.log(content);
    }

    public Gson getGson() {
        return gson;
    }

    public JsonParser getJsonParser() {
        return jsonParser;
    }
}
